$(function(){
	//登录
	$('#login').validate({
		submitHandler: function(form){
			$(form).ajaxSubmit({
				url : ThinkPHP['MODULE'] + '/Login/login',
				type : 'POST',
				success : function (responseText) {
					if(responseText == -9){
						alert('用户名或者密码错误/或已被停用');
					}else{
						alert('登录成功');
						location.href = ThinkPHP['INDEX'];	
					}
				}
			});
		},
		rules : {
			username : {
				required : true,
				minlength : 4,
				maxlength : 20,
			},
			password : {
				required : true,
				minlength : 4,
				maxlength : 30,
			},
			

		},
		messages : {
			username : {
				required : '必填',
				minlength : $.format('需大于{0}位'),
				maxlength : $.format('需小于{0}位'),
			},
			password : {
				required : '必填',
				minlength : $.format('需大于{0}位'),
				maxlength : $.format('需小于{0}位'),
			},
			

		},
		
		
	});
	
	

	
	
	
	
});